<?php include view('header');?>
<?php 
	function myecho($val)
	{
		if(empty($val))
			echo '无';
		else 
			echo $val;
	}
?>
<h1>项目详情</h1>

<div class="headactions">
	<a href="project.php?action=edit&id=<?php echo $project->getProperty('id');?>">[修改]</a>
</div>

<table class="chart" cellspacing="0">
	<tr>
		<th><label>项目代码：</label></th><td><?php myecho($project->getProperty('code'));?></td>
		<th><label>项目名称：</label></th><td><?php myecho($project->getProperty('name'));?></td>
	</tr>
	<tr>
		<th><label>项目负责人：</label></th><td><?php myecho ($project->getProperty('responsor'));?></td>
		<th><label>项目类型：</label></th><td><?php echo Project::$type[$project->getProperty('type')];?></td>
	</tr>
    <tr>
		<th><label>负责人电话：</label></th><td><?php myecho($project->getProperty('responsormobile'));?></td>
		<th><label>项目状态：</label></th><td><?php echo $projectstatus[$project->getProperty('status')];?></td>
	</tr>
	<tr>
		<th><label>添加项目时间：</label></th><td><?php myecho(rgmdate($project->getProperty('dateline')));?></td>
		<th><label>项目截止日期：</label></th><td><?php if($project->getProperty('deadline')==0)echo '无';else echo rgmdate($project->getProperty('deadline'),'Y-m-d');?></td>
	</tr>
	<tr>
		<th><label>捐赠单位：</label></th><td><?php myecho($project->getProperty('source'));?></td>
		<th><label>对方户名：</label></th><td><?php myecho($project->getProperty('sourceaccount'));?></td>
	</tr>
	<tr>
		<th><label>捐赠数额：</label></th><td><?php myecho($project->getProperty('amount'));?></td>
		<th><label>剩余金额：</label></th><td><?php myecho($project->getProperty('restamount'));?></td>
	</tr>
	<tr>
		<th><label>到账日期：</label></th><td><?php if($project->getProperty('creditedtime')==0)echo '无';else echo rgmdate($project->getProperty('creditedtime'),'Y-m-d');?></td>
		<th><label>指定用途：</label></th><td><?php myecho($project->getProperty('specifieduses'));?></td>
	</tr>
	<tr>
		<th><label>合同快照：</label></th>
		<td colspan="3">
		<?php if(!$project->getProperty('contrast')){?>
			没有上传合同扫描件
		<?php }else{?>
			<a href="<?php echo $project->getProperty('contrast');?>" target="_blank"><img src="<?php echo $project->getProperty('contrast');?>" width="100%" alt="点击查看原始尺寸" /></a>
		<?php }?>
		</td>
	</tr>
	<tr>
		<th><label>感谢信：</label></th>
		<td colspan="3">
		<?php if(!$project->getProperty('thankletter')){?>
			暂时没有感谢信
		<?php }else{?>
			<a href="<?php echo $project->getProperty('thankletter');?>">[点击下载]</a>
		<?php }?>
		</td>
	</tr>
</table>

<div class="list">
<table>
	<thead>
    	<tr><td>交易时间</td><td>金额</td><td>用途</td><td>类型</td><td>用款单位</td><td>操作</td></tr>
    </thead>
    <tbody>
    	<?php foreach($project->getProcess() as $p){?>
    	<tr>
        	<td><?php echo gmdate('Y-m-d',$p['dateline']);?></td>
			<td><?php echo $p['amount'];?></td>
			<td><?php echo $p['reason'];?></td>
			<td><?php echo $process_type[$p['type']];?></td>
            <td><?php echo $p['responsor'];?></td>
			<td><a href="project.php?action=deleteprocess&id=<?php echo $p['id'];?>">[删除]</a></td>
		</tr>
        <?php }?>
    </tbody>
</table>
</div>

<?php include view('footer');?>